| Conditions | 3 |
| Total Lines | 12 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | export interface IValueMap { |
||
| 15 | |||
| 16 | public translate(key: string, valueMap: IValueMap = {}) { |
||
| 17 | if (this.language.hasOwnProperty(key)) { |
||
| 18 | let translated = String(this.language[key]); |
||
| 19 | for (let pattern in valueMap) { |
||
| 20 | translated = translated.replace(new RegExp('{' + pattern + '}', 'g'), valueMap[pattern]); |
||
| 21 | } |
||
| 22 | |||
| 23 | return translated; |
||
| 24 | } |
||
| 25 | |||
| 26 | return key; |
||
| 27 | } |
||
| 28 | } |